﻿using System;
using System.IO;

namespace Logger
{
    public class Logger : ILogger
    {
        private readonly String _logPath;

        public Logger(String logPath)
        {
            _logPath = logPath;
        }

        public void WriteRecord(String record)
        {
            var file = new StreamWriter(_logPath, true);
            file.WriteLine(record);
            file.Close(); 
        }

        public String ReadAllRecords()
        {
            try
            {
                return File.ReadAllText(_logPath);
            }
            catch (Exception e)
            {
                return null;
            }
        }
    }
}
